package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.pojo.StuOption;
import com.itheima.service.impl.StuReportServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RequestMapping("/report")
@RestController
public class StuReportController {

    @Autowired
    private StuReportServiceImpl stuReportService;

    /**
     * 统计各个班级学生人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("统计各个班级学生人数");
        StuOption stuOption = stuReportService.getStudentCountData();
        return Result.success(stuOption);
    }
    /**
     * 统计学生学历信息
     */
    @GetMapping("/studentDegreeData")
    public Result getStuDegreeData(){
        log.info("统计学生学历信息");
        List<Map> degreeList = stuReportService.getStuDegreeData();
        return Result.success(degreeList);
    }
}